##############################################################
#Figure G1: Estimated Effect of Hurricane Irene on NJ Democrat Vote Share
##############################################################

nj.sen <- read.dta13("./temp/figg1adata.dta")

nj.sen$id <- c(2,1,NA, NA, 3, NA)
nj.sen <- na.omit(nj.sen)
sen <- ggplot(nj.sen, aes(as.factor(id), coef)) + 
  geom_errorbar(aes(ymin=coef - 1.96*se, ymax=coef + 1.96*se), 
                lwd=1,  width=0) +
  geom_errorbar(aes(ymin=coef - se, ymax=coef + se), 
                lwd=1.5,  width=0)   + 
  geom_point(shape = 21, colour = "black", fill = "white", size = 2) + 
  xlab("Distance Band") + ylab("Estimate on Democrat Share U.S. Senate") + ylim(-0.06, 0.06) + 
  scale_x_discrete(breaks=c(1,2,3), labels=c("[200,30)","[100,30)", "[50,30)")) + 
  theme_bw() + 
  theme(plot.title =element_text(hjust = .5, face="bold", size=15, colour = "black"),
        axis.text=element_text(size=12), 
        axis.title = element_text(size=15),
        panel.grid.minor = element_blank(),
        panel.grid.major.y = element_blank()) 



nj.house <- read.dta13("./temp/figg1bdata.dta")

nj.house$id <-  c(2,1,NA, NA, 3, NA)
nj.house <- na.omit(nj.house)

house <- ggplot(nj.house, aes(as.factor(id), coef)) + 
  geom_errorbar(aes(ymin=coef - 1.96*se, ymax=coef + 1.96*se), 
                lwd=1,  width=0) +
  geom_errorbar(aes(ymin=coef - se, ymax=coef + se), 
                lwd=1.5,  width=0)   + 
  geom_point(shape = 21, colour = "black", fill = "white", size = 2) + 
  xlab("Distance Band") + ylab("Estimate on Democrat Share U.S. House") + ylim(-.03, 0.10) + 
  scale_x_discrete(breaks=c(1,2,3), labels=c("[200,30)","[100,30)", "[50,30)")) + 
  theme_bw() + 
  theme(plot.title =element_text(hjust = .5, face="bold", size=15, colour = "black"),
        axis.text=element_text(size=12), 
        axis.title = element_text(size=15),
        panel.grid.minor = element_blank(),
        panel.grid.major.y = element_blank()) 

library(ggpubr)


ggarrange(sen, house)
ggsave(file="./figures/figg1.pdf")